package com.ruoyi.question.controller;


import com.github.pagehelper.PageInfo;
import com.ruoyi.question.domain.ExpressQuestion;
import com.ruoyi.question.domain.ExpressQuestionKind;
import com.ruoyi.question.service.IQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.web.controller.BaseController;

import java.util.List;


@RestController
@RequestMapping("/question")
@CrossOrigin
public class QuestionController extends BaseController
{
    @Autowired
    private IQuestionService questionService;

    //问题展示
    @GetMapping("/questionKindList")
    public PageInfo<ExpressQuestionKind> questionKindList(ExpressQuestionKind questionKind)
    {
        return questionService.questionKindList(questionKind);
    }
    @GetMapping("/questionList")
    public PageInfo<ExpressQuestion> questionList(ExpressQuestion question)
    {
        return questionService.questionList(question);
    }
    @GetMapping("/questionKind")
    public List<ExpressQuestionKind> questionKind(ExpressQuestionKind kind)
    {
        return questionService.questionKind(kind);
    }

    @PostMapping("/questionKindAdd")
    public int questionKindAdd(@RequestBody ExpressQuestionKind questionKind){
        return questionService.questionKindAdd(questionKind);
    }
    @PostMapping("/questionAdd")
    public int questionAdd(@RequestBody ExpressQuestion question){
        return questionService.questionAdd(question);
    }
    @PostMapping("/questionKindUpdate")
    public int questionKindUpdate(@RequestBody ExpressQuestionKind questionKind){
        return questionService.questionKindUpdate(questionKind);
    }
    @PostMapping("/questionUpdate")
    public int questionUpdate(@RequestBody ExpressQuestion question){
        return questionService.questionUpdate(question);
    }
   @GetMapping("/deleteQuestionKind")
    public int deleteQuestionKind(@RequestParam("id")Long id){
        return questionService.deleteQuestionKind(id);
    }
   @GetMapping("/deleteQuestion")
    public int deleteQuestion(@RequestParam("id")Long id){
        return questionService.deleteQuestion(id);
    }
    @PutMapping("/updatKindFalse")
    public int updatKindFalse(@RequestParam("id") Long id)
    {
        return questionService.updatKindFalse(id);
    }
    @PutMapping("/updateKindTrue")
    public int updateKindTrue(@RequestParam("id") Long id)
    {
        return questionService.updateKindTrue(id);
    }
    @PutMapping("/updateFalse")
    public int updateFalse(@RequestParam("id") Long id)
    {
        return questionService.updateFalse(id);
    }
    @PutMapping("/updateTrue")
    public int updateTrue(@RequestParam("id") Long id)
    {
        return questionService.updateTrue(id);
    }

}
